home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 436_01 / make.bat < prev    next >
DOS Batch File  |  1994-10-07  |  3KB  |  95 lines

  1. ::MAKE.BAT -- requires Borland MAKE.
  2. echo off
  3. cls
  4. :: Save path
  5. set op=%path%
  6. if     "%1"=="?" goto :HELP
  7. if not "%1"==""  goto :DOIT
  8. :HELP
  9. :: Set name to caps
  10. path=%0
  11. echo Syntax is:  %path%  MAKEFILE  [T]  [D]  [M]  [X  [X  [...]]]
  12. echo/ 
  13. echo  MAKEFILE   The name of the make file for MAKE.EXE to process (include
  14. echo             the extension if it is not .MAK).
  15. echo         T   Runs MAKE.EXE in test mode with the -n switch (prints
  16. echo             commands but does not actually perform them).
  17. echo         D   Activates compiler switches to put debugging info into
  18. echo             output files by defining DEBUG (-DDEBUG) on the MAKE.EXE
  19. echo             command line.
  20. echo         M   Must be either S, M, C, or L, and defines the memory
  21. echo             model (-DMDL=M).   Default is S.
  22. echo         X   Is any number of additional TC command-line switches or
  23. echo             definitions, separated by at least one space.
  24. echo/
  25. echo MAKEFILE must be the first parameter; others may appear in any order.
  26. echo Case is significant only in X parameters that you define in the make
  27. echo file; %path%.BAT takes care of the rest.  If more than one M occurs,
  28. echo the last is used.  Xs are concatenated (with a space for separation)
  29. echo and passed to MAKE.EXE in an environment variable.  You can't use ';'
  30. echo to gang X parameters or use '=' to define strings, since COMMAND.COM
  31. echo treats those characters as command line delimiters.
  32. goto :EXIT
  33. :DOIT
  34. :: Default mem model
  35. set m=s
  36. for %%x in (%1 %1.mak) do if exist %%x goto :EXISTS
  37. echo Can't find make file:  %1
  38. echo/ 
  39. goto :HELP
  40. :EXISTS                                ::save makefile name
  41. set f=%1
  42. :LOOP
  43. shift
  44. if "%1"=="" goto :MAKE                 ::shift parms until no more
  45. ::
  46. for %%x in (t d s m c l T D S M C L) do if "%%x"=="%1" goto :%%x
  47. ::
  48. :: Concat X parms, separated by space
  49. ::
  50. set x=%x% %1
  51. goto :LOOP
  52. :t                                     ::test mode
  53. :T
  54. set t=-n
  55. goto :LOOP
  56. :d                                     ::compile w/DEBUG
  57. :D
  58. set d=-DDEBUG
  59. goto :LOOP
  60. ::
  61. ::Borland's MAKE doesn't like memory model in caps (damn).
  62. ::
  63. :s
  64. :S
  65. set m=s
  66. goto :LOOP
  67. :m
  68. :M
  69. set m=m
  70. goto :LOOP
  71. :c
  72. :C
  73. set m=c
  74. goto :LOOP
  75. :l
  76. :L
  77. set m=l
  78. goto :LOOP
  79. :MAKE
  80. if exist c:\tc\make.exe goto :MAKE_OK
  81. echo Can't find \TC\MAKE.EXE
  82. goto :EXIT
  83. :MAKE_OK
  84. echo c:\tc\make -a -f%f% %t% %d% -DMDL=%m% %x%
  85.      c:\tc\make -a -f%f% %t% %d% -DMDL=%m% %x%
  86. :EXIT
  87. path=%op%
  88. set op=
  89. set x=
  90. set f=
  91. set t=
  92. set d=
  93. set m=
  94. 
  95.